@extends('admin.layout.layout')
<style>
    .mobile .content {
        margin: auto 0;
        height: 550px;
        width: 300px;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        background-image: url('{{ asset('static/xadmin/images/WechatIMG42.png') }}')
    }

    .mobile .content .quan-content {
        width: 220px;
        height: 100px;
        position: absolute;
        top: 0;
        left: 0;
        right: -12px;
        bottom: 0;
        margin: auto;
        border: 1px solid rgba(204, 204, 204, 1);
    }

    .quan-content-left {
        height: 100%;
        border-right: 1px dashed rgba(204, 204, 204, 1)
    }

    .quan-content-left-title {
        height: 50%;
        text-align: center;
    }

    .quan-content-left-title-content {
        line-height: 58px;
        font-size: 23px;
    }

    .quan-content-left-title-content p {
        width: 100%;
        height: auto;
        word-wrap: break-word;
        word-break: break-all;
        overflow: hidden;
    }

    .quan-content-right-title-content {
        line-height: 58px;
        font-size: 16px;
    }

    .quan-content-right-title-content_ {
        font-size: 14px;
    }

</style>
@section('content')
    <div class="layui-fluid">
        <div class="layui-fluid layui-card">
            <div class="layui-row ">

                <div class="layui-col-md11">
                    <form class="layui-form" lay-filter="form1">
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                banner图
                                <span class="x-red">*</span></label>
                            <div class="layui-input-block">
                                <div id="cupload-create"></div>
                            </div>
                        </div>
                        <div class="layui-form-item promotion_mode_child">
                            <div class="layui-inline">
                                <label class="layui-form-label">标题</label>
                                <div class="layui-input-inline" style="width: 500px;">
                                <textarea name="title"  placeholder="请输入" class="layui-textarea"></textarea>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item promotion_mode_child">
                            <div class="layui-inline">
                                <label class="layui-form-label">内容</label>
                                <div class="layui-input-inline" style="width: 500px;">
                                <textarea name="content"  placeholder="请输入" class="layui-textarea"></textarea>
                                </div>
                            </div>
                        </div>

                            <div class="layui-form-item"></div>
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="add">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
@endsection
@section('js')
    <script>
        var cuploadCreate = new Cupload ({
			ele: '#cupload-create',
			num: 1,
		});
        layui.use(['form', 'layer','laydate','layedit'],
            function () {
                $ = layui.jquery;
                var form = layui.form,
                    layer = layui.layer,
                    laydate = layui.laydate;
                var layedit = layui.layedit;

                form.render();
                form.verify({
                    explain: function(value){
                        layedit.sync(index);
                    }
                });
                form.on('submit(add)',
                    function (data) {
                        $.post('{{asset('admin/banners/store')}}', data.field, function (res) {
                            console.log(res);
                            if (res.status == 'success') {
                                layer.alert(res.msg, {
                                    icon: 6
                                },function () {
                                    parent.xadmin.add_tab('banner图列表',"{{asset('admin/banners')}}",true);
                                    xadmin.del_tab();
                                });
                            } else {
                                layer.alert(res.msg, {
                                    icon: 5
                                });
                            }
                        });
                        return false;
                    });
            });

    </script>
@endsection
